<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Mali OpenCL SDK v1.1.0: /home/jenkins/workspace/opencl_sdk_daily/Architecture/x86/OS/linux/common/image.cpp File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">Mali OpenCL SDK v1.1.0
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.2 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Home</span></a></li>
      <li><a href="pages.html"><span>Help&#160;and&#160;Tutorials</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('image_8cpp.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">image.cpp File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;<a class="el" href="image_8h_source.html">image.h</a>&quot;</code><br/>
<code>#include &lt;fstream&gt;</code><br/>
<code>#include &lt;iostream&gt;</code><br/>
</div>
<p><a href="image_8cpp_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ad7fed8ed5795a8ddd3e86265cc5a4d31"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="image_8cpp.html#ad7fed8ed5795a8ddd3e86265cc5a4d31">saveToBitmap</a> (string filename, int width, int height, const unsigned char *imageData)</td></tr>
<tr class="separator:ad7fed8ed5795a8ddd3e86265cc5a4d31"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a24ebc43a2f3d72aff84912a1a69f2c39"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="image_8cpp.html#a24ebc43a2f3d72aff84912a1a69f2c39">loadFromBitmap</a> (const string filename, int *const width, int *const height, unsigned char **imageData)</td></tr>
<tr class="separator:a24ebc43a2f3d72aff84912a1a69f2c39"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9390e4ddc634d83452a15e93017ab979"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="image_8cpp.html#a9390e4ddc634d83452a15e93017ab979">luminanceToRGB</a> (const unsigned char *luminanceData, unsigned char *rgbData, int width, int height)</td></tr>
<tr class="memdesc:a9390e4ddc634d83452a15e93017ab979"><td class="mdescLeft">&#160;</td><td class="mdescRight">Convert 8-bits per pixel luminance data to 24-bits per pixel RGB data.  <a href="#a9390e4ddc634d83452a15e93017ab979"></a><br/></td></tr>
<tr class="separator:a9390e4ddc634d83452a15e93017ab979"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a75fa143dccc45f3d5dc030884ca09cc9"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="image_8cpp.html#a75fa143dccc45f3d5dc030884ca09cc9">RGBToLuminance</a> (const unsigned char *const rgbData, unsigned char *const luminanceData, int width, int height)</td></tr>
<tr class="memdesc:a75fa143dccc45f3d5dc030884ca09cc9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Convert 24-bits per pixel RGB data to 8-bits per pixel luminance data.  <a href="#a75fa143dccc45f3d5dc030884ca09cc9"></a><br/></td></tr>
<tr class="separator:a75fa143dccc45f3d5dc030884ca09cc9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a83b7aea3d44c26db2222227c0dc5d19a"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="image_8cpp.html#a83b7aea3d44c26db2222227c0dc5d19a">RGBToRGBA</a> (const unsigned char *const rgbData, unsigned char *const rgbaData, int width, int height)</td></tr>
<tr class="memdesc:a83b7aea3d44c26db2222227c0dc5d19a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Convert 24-bits per pixel RGB data to 32-bits per pixel RGBA data.  <a href="#a83b7aea3d44c26db2222227c0dc5d19a"></a><br/></td></tr>
<tr class="separator:a83b7aea3d44c26db2222227c0dc5d19a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a872cec0732df69b80796a61acea716f0"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="image_8cpp.html#a872cec0732df69b80796a61acea716f0">RGBAToRGB</a> (const unsigned char *const rgbaData, unsigned char *const rgbData, int width, int height)</td></tr>
<tr class="memdesc:a872cec0732df69b80796a61acea716f0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Convert 32-bits per pixel RGBA data to 24-bits per pixel RGB data.  <a href="#a872cec0732df69b80796a61acea716f0"></a><br/></td></tr>
<tr class="separator:a872cec0732df69b80796a61acea716f0"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a24ebc43a2f3d72aff84912a1a69f2c39"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool loadFromBitmap </td>
          <td>(</td>
          <td class="paramtype">const string&#160;</td>
          <td class="paramname"><em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *const&#160;</td>
          <td class="paramname"><em>width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *const&#160;</td>
          <td class="paramname"><em>height</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char **&#160;</td>
          <td class="paramname"><em>imageData</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="image_8cpp_source.html#l00115">115</a> of file <a class="el" href="image_8cpp_source.html">image.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a9390e4ddc634d83452a15e93017ab979"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool luminanceToRGB </td>
          <td>(</td>
          <td class="paramtype">const unsigned char *&#160;</td>
          <td class="paramname"><em>luminanceData</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char *&#160;</td>
          <td class="paramname"><em>rgbData</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>height</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Convert 8-bits per pixel luminance data to 24-bits per pixel RGB data. </p>
<p>Each RGB pixel is created using the luminance value for each component. For example, a pixel with luminance of 125 will convert into an RGB pixel with values R = 125, G = 125, and B = 125. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">luminanceData</td><td>Pointer to a block of 8-bits per pixel luminance data. Must be width * height bytes in size. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">rgbData</td><td>Pointer to a data block containing the 24-bits per pixel RGB data. The data block must be initialised with a size of 3 * width * height bytes. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">width</td><td>The width of the image. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">height</td><td>The height of the image. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>False if an error occurred, true otherwise. </dd></dl>

<p>Definition at line <a class="el" href="image_8cpp_source.html#l00243">243</a> of file <a class="el" href="image_8cpp_source.html">image.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a872cec0732df69b80796a61acea716f0"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool RGBAToRGB </td>
          <td>(</td>
          <td class="paramtype">const unsigned char *&#160;</td>
          <td class="paramname"><em>rgbaData</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char *&#160;</td>
          <td class="paramname"><em>rgbData</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>height</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Convert 32-bits per pixel RGBA data to 24-bits per pixel RGB data. </p>
<p>The alpha values are discarded. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">rgbaData</td><td>Pointer to a block of 32-bits per pixel RGBA data. Must be 4 * width * height bytes in size. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">rgbData</td><td>Pointer to a data block containing the 24-bits per pixel RGB data. The data block must be initialised with a size of 3 * width * height bytes. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">width</td><td>The width of the image. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">height</td><td>The height of the image. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>False if an error occurred, true otherwise. </dd></dl>

<p>Definition at line <a class="el" href="image_8cpp_source.html#l00318">318</a> of file <a class="el" href="image_8cpp_source.html">image.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a75fa143dccc45f3d5dc030884ca09cc9"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool RGBToLuminance </td>
          <td>(</td>
          <td class="paramtype">const unsigned char *&#160;</td>
          <td class="paramname"><em>rgbData</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char *&#160;</td>
          <td class="paramname"><em>luminanceData</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>height</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Convert 24-bits per pixel RGB data to 8-bits per pixel luminance data. </p>
<p>Each luminance pixel is created using a weighted sum of the RGB values. The weightings are 0.2126R, 0.7152G, and 0.0722B. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">rgbData</td><td>Pointer to a block of 24-bits per pixel RGB data. Must be 3 * width * height bytes in size. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">luminanceData</td><td>Pointer to a data block containing the 8-bits per pixel luminanceData data. The data block must be initialised with a size of width * height bytes. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">width</td><td>The width of the image. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">height</td><td>The height of the image. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>False if an error occurred, true otherwise. </dd></dl>

<p>Definition at line <a class="el" href="image_8cpp_source.html#l00267">267</a> of file <a class="el" href="image_8cpp_source.html">image.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a83b7aea3d44c26db2222227c0dc5d19a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool RGBToRGBA </td>
          <td>(</td>
          <td class="paramtype">const unsigned char *&#160;</td>
          <td class="paramname"><em>rgbData</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char *&#160;</td>
          <td class="paramname"><em>rgbaData</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>height</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Convert 24-bits per pixel RGB data to 32-bits per pixel RGBA data. </p>
<p>The alpha values are all set to 255. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">rgbData</td><td>Pointer to a block of 24-bits per pixel RGB data. Must be 3 * width * height bytes in size. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">rgbaData</td><td>Pointer to a data block containing the 32-bits per pixel RGBA data. The data block must be initialised with a size of 4 * width * height bytes. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">width</td><td>The width of the image. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">height</td><td>The height of the image. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>False if an error occurred, true otherwise. </dd></dl>

<p>Definition at line <a class="el" href="image_8cpp_source.html#l00291">291</a> of file <a class="el" href="image_8cpp_source.html">image.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="ad7fed8ed5795a8ddd3e86265cc5a4d31"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool saveToBitmap </td>
          <td>(</td>
          <td class="paramtype">string&#160;</td>
          <td class="paramname"><em>filename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>width</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>height</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const unsigned char *&#160;</td>
          <td class="paramname"><em>imageData</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="image_8cpp_source.html#l00017">17</a> of file <a class="el" href="image_8cpp_source.html">image.cpp</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_bdd9a5d540de89e9fe90efdfc6973a4f.html">common</a></li><li class="navelem"><a class="el" href="image_8cpp.html">image.cpp</a></li>
    <li class="footer">
        <a href="http://www.arm.com/">(C) ARM Ltd. 2013</a>
    </li>
  </ul>
</div>
</body>
</html>
